<%@ include file="/WEB-INF/jsp/header.jsp" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 

<h1>Vyberte fotografie (2/3)</h1>

File info: ${fileInfo}

<form:form method="POST" modelAttribute="photo" enctype="multipart/form-data">
  <table>
    <tr>
      <td>
      	Vyberte soubor s obrázkem:
      </td>
      <td> 
      	<input type="file" name="file">
      </td>
    </tr>
    <tr>
      <td>
        Vložte komentář:
      </td>
      <td> 
        	<textarea name="description" rows="4" cols="50">
			</textarea> 
      </td>
    </tr>
    <tr>
      <td>
      	<p class="submit"><input type="submit" value="Přidat fotografii"/></p>
      </td>
    </tr>
  </table>
</form:form>

<a href="<spring:url value="/gallery/show/${gallery.id}" />">Dokončit</a>

<h2>Fotografie v galerii</h2>

<c:choose>
  	<c:when test="${empty photos}">
  		<p>V galerii nejsou zadne fotografie</p> 
  	</c:when>
  	<c:otherwise>
  		<c:forEach var="photo" items="${photos}">
  			<div class="snapshot">
				<div class="">
					<a href="<spring:url value="/gallery/add /${gallery.id}/deletephoto/${photo.id}" htmlEscape="true" />" title="Odstranit">X</a>
				</div>
				<div class="photoThumbnail">
					<img src="${pageContext.request.contextPath}/uploaded/${photo.gallery.owner.userName}/${photo.gallery.rootFolder}/thumbnails/${photo.fileName}" height="100" title="${photo.description}"/>
				</div>
			</div>
		</c:forEach>
  	</c:otherwise>
</c:choose>


<%@ include file="/WEB-INF/jsp/footer.jsp" %>